{% extends 'KeioStudyBundle::layout.html.twig' %}

{% block content %}
    <h3>User edit</h3>

<form action="{{ path('admin_user_update', { 'id': entity.id }) }}" method="post" {{ form_enctype(edit_form) }}>
  <table width="100%">
    <tr>
      <td colspan="2">
        <div id="div_form_error">
          <font style="color:red; font-size:12">{{ form_errors(edit_form) }}</font>
        </div>
      </td>
    </tr>
    <tr>
      <td width="20%">
        {{ form_label(edit_form.hoten) }}
      </td>
      <td>
        {{ form_widget(edit_form.hoten) }}
      </td>
    </tr>
    <tr>
      <td>
        {{ form_label(edit_form.email) }}
      </td>
      <td>
        {{ form_widget(edit_form.email) }}
      </td>
    </tr>
    <tr>
      <td>
        {{ form_label(edit_form.username) }}
      </td>
      <td>
        {{ form_widget(edit_form.username) }}
      </td>
    </tr>
    <tr>
      <td>
        {{ form_label(edit_form.password) }}
      </td>
      <td>
        {{ form_widget(edit_form.password) }}
      </td>
    </tr>
    <tr>
      <td>
        <p>Nhập lại pasword
      </td>
      <td>
        <input type="password" name="pwdR" required="required">
      </td>
    </tr>
    <tr>
      <td>
        {{ form_label(edit_form.dienthoai) }}
      </td>
      <td>
        {{ form_widget(edit_form.dienthoai) }}
      </td>
    </tr>
    <tr>
      <td>
        {{ form_label(edit_form.dotuoi) }}
      </td>
      <td>
        {{ form_widget(edit_form.dotuoi) }}
      </td>
    </tr>
    <tr>
      <td>
        <p>Quyền truy cập
      </td>
      <td>
        <div id="adm_roles">
        <input type="checkbox" name="roles[]" value="ROLE_USER"
          {% if roleschecked[1]==1 %} checked="checked"{% endif %}
          ><label>Role user</label>
		<input type="checkbox" name="roles[]" value="ROLE_AUTHOR"
		  {% if roleschecked[2]==1 %} checked="checked"{% endif %}
		  ><label>Role author</label>
		<input type="checkbox" name="roles[]" value="ROLE_ADMIN"
		  {% if roleschecked[3]==1 %} checked="checked"{% endif %}
		  ><label>Role admin</label>
		</div>

		{{ form_rest(edit_form) }}

      </td>
    </tr>
    <tr>
      <td colspan="2" align="center">
        <p>
            <button type="submit">Edit</button>
        </p>
      </td>
    </tr>
  <table>
</form>

        <ul class="record_actions">
    <li>
        <a href="{{ path('admin_user') }}">
            Back to the list
        </a>
    </li>
</ul>
{% endblock %}
